unit fmSplitDetail;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
  cxStyles, cxCustomData, cxFilter, cxData, cxDataStorage, cxEdit, DB,
  cxDBData, cxDBLookupComboBox, StdCtrls, Buttons, ComCtrls, cxGridLevel,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
  cxGridCustomView, cxGrid, MemDS, DBAccess, MSAccess;

type
  TSplitDetailForm = class(TForm)
    msspSplitDetail: TMSStoredProc;
    dsSplit: TDataSource;
    cxgrid1: TcxGrid;
    tvSplit: TcxGridDBTableView;
    glSplit: TcxGridLevel;
    grp1: TGroupBox;
    lbl1: TLabel;
    lbl2: TLabel;
    dtpBegin: TDateTimePicker;
    dtpEnd: TDateTimePicker;
    btnOK: TBitBtn;
    btnPrint: TBitBtn;
    cxgrid3: TcxGrid;
    tvSplitValue1: TcxGridDBTableView;
    glSplitValue1: TcxGridLevel;
    tvSplitExitDate: TcxGridDBColumn;
    tvSplitPayCardNo: TcxGridDBColumn;
    tvSplitEnStation: TcxGridDBColumn;
    tvSplitExStation: TcxGridDBColumn;
    tvSplitTollMoney: TcxGridDBColumn;
    tvSplitDiscountRate: TcxGridDBColumn;
    tvSplitRealMoney: TcxGridDBColumn;
    tvSplitSplitCount: TcxGridDBColumn;
    tvSplitVehClass: TcxGridDBColumn;
    qrySplitValue: TMSQuery;
    srcSplitValue: TDataSource;
    tvSplitValue1RoadID: TcxGridDBColumn;
    tvSplitValue1Splitmoney: TcxGridDBColumn;
    tvSplitValue1OwnerId: TcxGridDBColumn;
    tvSplitValue1SplitNo: TcxGridDBColumn;
    tblRoad: TMSTable;
    dsRoad: TDataSource;
    dsOwner: TDataSource;
    tblOwner: TMSTable;
    procedure btnOKClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  SplitDetailForm: TSplitDetailForm;

implementation

uses
  fmMain;

{$R *.dfm}

procedure TSplitDetailForm.btnOKClick(Sender: TObject);
begin
   msspSplitDetail.Close;
   msspSplitDetail.Params.ParamByName('Begindate').AsDate := dtpBegin.Date;
   msspSplitDetail.Params.ParamByName('EndDate').AsDate   := dtpEnd.Date;
   msspSplitDetail.Open;
   qrySplitValue.Close;
   qrySplitValue.Open;
   
end;

procedure TSplitDetailForm.FormCreate(Sender: TObject);
begin
   dtpEnd.Date   := Date;
   dtpbegin.Date := Date - 30;
   tblRoad.Open;
   tblOwner.Open;
end;

procedure TSplitDetailForm.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin

   tblRoad.Close;
   tblOwner.Close;
   Action := caFree;
end;

end.
